# 统一响应格式函数
def success_response(message='操作成功', data=None, pagination=None):
    """成功响应的统一格式"""
    response = {
        'status': 'success',
        'message': message
    }
    
    if data is not None:
        response['data'] = data
    
    if pagination is not None:
        response['pagination'] = pagination
    
    return jsonify(response)


def error_response(message='操作失败', error=None, status_code=400):
    """错误响应的统一格式"""
    response = {
        'status': 'error',
        'message': message
    }
    
    if error is not None:
        response['error'] = str(error)
    
    return jsonify(response), status_code